import { RouteRecordRaw } from "vue-router";

// 页面组件
import InitPage from "../views/InitPage";
import LoginPage from "../views/LoginPage";
import WithHeaderWithFooter from "../components/WithHeaderWithFooter";
import WithoutHeaderWithFooter from "../components/WithoutHeaderWithFooter";
import IndexPage from "../views/IndexPage";
import CoursePage from "../views/CoursePage";
import CoursePlayPage from "../views/CoursePlayPage";
import LatestLearnPage from "../views/LatestLearnPage";
import ErrorPage from "../views/ErrorPage";

const routes: RouteRecordRaw[] = [
  {
    path: "/",
    component: InitPage,
    children: [
      {
        path: "",
        component: WithHeaderWithFooter,
        children: [
          {
            path: "",
            component: IndexPage,
          },
          {
            path: "course/:courseId",
            component: CoursePage,
          },
          {
            path: "course/:courseId/hour/:hourId",
            component: CoursePlayPage,
          },
          {
            path: "latest-learn",
            component: LatestLearnPage,
          },
        ],
      },
      {
        path: "login",
        component: WithoutHeaderWithFooter,
        children: [
          {
            path: "",
            component: LoginPage,
          },
        ],
      },
      {
        path: "error",
        component: ErrorPage,
      },
      {
        path: ":pathMatch(.*)*",
        component: ErrorPage,
      },
    ],
  },
];

export default routes;
